package com.aspose.cells;

abstract class zew {
   static double a(DateTime var0, DateTime var1, double var2) {
      double var4 = 0.0D;
      double var6 = a(var0, var1);
      if (var6 > 182.0D) {
         double var8 = (100.0D - var2 * 100.0D * var6 / 360.0D) / 100.0D;
         double var10 = 0.0D;
         if (var6 == 366.0D) {
            var10 = 366.0D;
         } else {
            var10 = 365.0D;
         }

         double var12 = Math.pow(var6 / var10, 2.0D) - (2.0D * var6 / var10 - 1.0D) * (1.0D - 1.0D / var8);
         double var14 = Math.sqrt(var12);
         double var16 = 2.0D * var6 / var10 - 1.0D;
         var4 = 2.0D * (var14 - var6 / var10) / var16;
      } else {
         var4 = 365.0D * var2 / (360.0D - var2 * var6);
      }

      return var4;
   }

   static double b(DateTime var0, DateTime var1, double var2) {
      double var4 = 0.0D;
      double var6 = a(var0, var1);
      var4 = 100.0D * (1.0D - var2 * var6 / 360.0D);
      return var4;
   }

   static double c(DateTime var0, DateTime var1, double var2) {
      double var4 = 0.0D;
      double var6 = a(var0, var1);
      var4 = (100.0D - var2) / var2 * 360.0D / var6;
      return var4;
   }

   private static double a(DateTime var0, DateTime var1) {
      com.aspose.cells.b.a.zk var2 = var1.a(var0);
      return (double)var2.b();
   }

   static double a(double var0, double var2, double var4, int var6, int var7, int var8) {
      double var9 = 0.0D;
      double var11 = 0.0D;
      double var13 = 0.0D;
      double var15 = a(var0, var2, var4, 0.0D, (double)var8);
      int var17 = 1;
      if (var8 == 1) {
         var4 += var15;
         ++var17;
      }

      for(; var17 <= var7; ++var17) {
         var13 = var4 * var0;
         var9 = var15 + var13;
         var4 += var9;
         if (var6 <= var17) {
            var11 += var13;
         }
      }

      return -var11;
   }

   static double b(double var0, double var2, double var4, int var6, int var7, int var8) {
      double var9 = a(var0, var2, var4, var6, var7, var8);
      return (double)(var7 - var6 + 1) * a(var0, var2, var4, 0.0D, (double)var8) - var9;
   }

   static double a(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -(var6 + var4) / var2;
      } else {
         double var12 = Math.pow(1.0D + var0, var2);
         if (Double.isInfinite(var12)) {
            var10 = -var4 * var0 / (1.0D + var0 * var8);
         } else {
            var10 = -var6;
            var10 = (var10 - var4 * var12) / ((1.0D + var8 * var0) * ((var12 - 1.0D) / var0));
         }
      }

      return var10;
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = a(var0, var4, var6, var8, var10);
      double var14 = var12;
      double var16 = 0.0D;
      if (var10 == 1.0D) {
         --var2;
         var6 += var12;
      }

      for(int var18 = 0; (double)var18 < var2; ++var18) {
         var16 = var6 * var0;
         var14 = var12 + var16;
         var6 += var14;
      }

      return var14;
   }

   static double b(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = a(var0, var4, var6, var8, var10);
      double var14 = 0.0D;
      double var16 = 0.0D;
      if (var10 == 1.0D) {
         --var2;
         var6 += var12;
      }

      for(int var18 = 0; (double)var18 < var2; ++var18) {
         var16 = var6 * var0;
         var14 = var12 + var16;
         var6 += var14;
      }

      return -var16;
   }

   static double b(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -var6 - var4 * var2;
      } else {
         var10 = -var6;
         double var12 = Math.pow(1.0D + var0, var2);
         if (Double.isInfinite(var12)) {
            var10 = -var4 * (1.0D + var0 * var8) / var0;
         } else {
            var10 -= var4 * (1.0D + var8 * var0) * ((var12 - 1.0D) / var0);
            var10 /= var12;
         }
      }

      return var10;
   }

   static double c(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -var6 - var4 * var2;
      } else {
         double var12 = a(1.0D + var0, var2);
         var10 = -var6 * var12;
         var10 -= var4 * (1.0D + var8 * var0) * (var12 - 1.0D) / var0;
      }

      return var10;
   }

   private static double a(double var0, double var2) {
      if (var2 < 0.0D) {
         return 1.0D / a(var0, -var2);
      } else {
         int var4 = (int)var2;
         return var2 != (double)var4 ? Math.pow(var0, var2) : a(var0, var4);
      }
   }

   private static double a(double var0, int var2) {
      if (var0 == 0.0D) {
         return 0.0D;
      } else if (var2 == 0) {
         return 1.0D;
      } else {
         double var3;
         int var6;
         for(var3 = 1.0D; var2 != 0; var2 = var6) {
            int var5 = var2 % 2;
            var6 = var2 / 2;
            if (var5 != 0) {
               var3 *= var0;
            }

            var0 *= var0;
         }

         return var3;
      }
   }

   static double d(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 1.0D - Math.pow(var2 / var0, 1.0D / var4);
      var10 = Math.floor(var10 * 1000.0D + 0.5D) / 1000.0D;
      double var12 = var0 * var10 * var8 / 12.0D;
      if (var6 <= 1.0D) {
         return var12 * var6;
      } else {
         if (var6 > 2.0D) {
            for(int var14 = 2; (double)var14 < var6; ++var14) {
               var12 += (var0 - var12) * var10;
            }
         }

         return var6 > var4 ? (var0 - var12) * var10 * (12.0D - var8) / 12.0D : (var0 - var12) * var10;
      }
   }

   static double e(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      double var12 = 0.0D;

      for(int var14 = 0; (double)var14 < var6; ++var14) {
         var10 = (var0 - var12) * var8 / var4;
         if (var10 > var0 - var2 - var12) {
            var10 = var0 - var2 - var12;
            if ((double)var14 != var6 - 1.0D) {
               return 0.0D;
            }

            return var10;
         }

         var12 += var10;
      }

      return var10;
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10, boolean var12) {
      if (var8 > var4 + 1.0D) {
         return 0.0D;
      } else {
         double var13 = var10 / var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double var19 = 0.0D;
         int var21 = (int)(var8 + 0.5D);

         for(int var22 = 1; var22 <= var21; ++var22) {
            var19 = Math.min((var0 - var15) * var13, var0 - var15 - var2);
            if (var6 < (double)var22) {
               var17 += var19;
            }

            var15 += var19;
         }

         return var17 - var19 * ((double)var21 - var8);
      }
   }

   static double f(double var0, double var2, double var4, double var6, double var8) {
      double var10 = (var2 * (1.0D + var0 * var8) / var0 - var6) / (var4 + var2 * (1.0D + var0 * var8) / var0);
      return com.aspose.cells.b.a.zq.a(var10, 1.0D + var0);
   }

   static zagu c(double var0, double var2, double var4, double var6, double var8, double var10) {
      if (var0 == 0.0D) {
         return zze.a;
      } else if (var4 + var6 + var2 * var0 == 0.0D) {
         return new zyy(0.0D);
      } else {
         zaow var12 = new zaow();
         if (var2 < 0.0D && var6 == 0.0D) {
            double var13 = -var2 / var4;
            if (Math.abs(var13) < Math.abs(var10)) {
               var10 = var13;
            }
         }

         return (zagu)(var12.a(var0, var2, var4, var6, var8, var10) == 0 ? new zyy(var12.a()) : zze.a);
      }
   }

   static double a(DateTime var0, DateTime var1, int var2, int var3) {
      switch(var3) {
      case 0:
         return a(e(var0, var1, var2, var3), var0, false);
      case 1:
         return a(e(var0, var1, var2, var3), var0);
      case 2:
         return a(e(var0, var1, var2, var3), var0);
      case 3:
         return a(e(var0, var1, var2, var3), var0);
      case 4:
         return b(e(var0, var1, var2, var3), var0);
      default:
         return 0.0D;
      }
   }

   static double b(DateTime var0, DateTime var1, int var2, int var3) {
      switch(var3) {
      case 0:
         return 360.0D / (double)var2;
      case 1:
         return a(var0, var1, var2);
      case 2:
         return 360.0D / (double)var2;
      case 3:
         return 365.0D / (double)var2;
      case 4:
         return 360.0D / (double)var2;
      default:
         return 0.0D;
      }
   }

   static double c(DateTime var0, DateTime var1, int var2, int var3) {
      switch(var3) {
      case 0:
         DateTime var4 = e(var0, var1, var2, var3);
         DateTime var5 = d(var0, var1, var2, var3);
         double var6 = a(var4, var5, true);
         double var8 = a(var4, var0, false);
         return var6 - var8;
      case 1:
         return a(var0, d(var0, var1, var2, var3));
      case 2:
         return a(var0, d(var0, var1, var2, var3));
      case 3:
         return a(var0, d(var0, var1, var2, var3));
      case 4:
         return b(d(var0, var1, var2, var3), var0);
      default:
         return 0.0D;
      }
   }

   static DateTime d(DateTime var0, DateTime var1, int var2, int var3) {
      boolean var4 = false;
      int var5 = a(var0.getYear(), var0.getMonth());
      if (var5 == var0.getDay()) {
         var4 = true;
      }

      int var6 = -12 / var2;
      return a(var0, var1, var6, var3, 0.0D, var4);
   }

   static DateTime e(DateTime var0, DateTime var1, int var2, int var3) {
      boolean var4 = b(var1);
      int var5 = -12 / var2;
      boolean var6 = false;
      if (var5 > 0) {
         var6 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var6 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      if (var6) {
         return var0;
      } else {
         DateTime var7 = var1;

         while(com.aspose.cells.a.c.zk.b(var7, var0)) {
            var7 = a(var7, var5, var3, var4);
            if (com.aspose.cells.a.c.zk.a(var7, var1)) {
               var7 = var0;
               break;
            }
         }

         return var7;
      }
   }

   static double f(DateTime var0, DateTime var1, int var2, int var3) {
      DateTime var4 = e(var0, var1, var2, var3);
      double var5 = (double)((var1.getYear() - var4.getYear()) * 12 + (var1.getMonth() - var4.getMonth()));
      return var5 * (double)var2 / 12.0D;
   }

   static zagu a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7, int var8) {
      int var10 = 12 / var7;
      DateTime var11;
      if (com.aspose.cells.a.c.zk.b(var2, var1)) {
         var11 = e(var1, var2, var10, var8);
      } else {
         var11 = a(var1, -var10, var8, true);
      }

      if (com.aspose.cells.a.c.zk.a(var11, var1)) {
         return zze.a;
      } else {
         DateTime var12 = com.aspose.cells.a.c.zk.b(var0, var11) ? var0 : var11;
         double var13 = a(var12, var2, (byte)1, var8);
         double var15 = b(var11, var1, var7, var8);
         double var17 = var13 / var15;
         if (com.aspose.cells.a.c.zk.b(var11, var0)) {
            if (var8 == 0) {
               var13 = a(var0, var12, com.aspose.cells.a.c.zk.c(var0, var11)) - 1.0D;
               var15 = b(var11, var1, var7, var8);
            } else {
               var13 = a(var0, var12, (byte)1, var8);
               if (var8 == 2) {
                  var15 = b(var11, var1, var7, var8);
               } else if (var8 == 3) {
                  var15 = 365.0D / (double)var7;
               } else {
                  var15 = b(var11, var1, var7, var8) - 2.0D;
               }
            }

            var17 += var13 / var15;
         }

         return new zyy(var5 * var3 / (double)var7 * var17);
      }
   }

   static double a(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = a(var0, var1, (byte)1, var6);
      double var9 = b(var0, var1, var6);
      return var4 * var2 * var7 / var9;
   }

   static double b(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = b(var0, var1, var6);
      double var9 = a(var0, var1, (byte)1, var6);
      double var11 = 1.0D - var2 / var4;
      double var13 = var11 * var7 / var9;
      return var13;
   }

   static double c(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = b(var0, var1, var6);
      double var9 = a(var0, var1, (byte)1, var6);
      return (var4 - var2) / var2 * var7 / var9;
   }

   static double d(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = b(var0, var1, var6);
      double var9 = a(var0, var1, (byte)1, var6);
      return var4 - var2 * var4 * var9 / var7;
   }

   static double e(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = b(var0, var1, var6);
      double var9 = a(var0, var1, (byte)1, var6);
      double var11 = var4 * var9 / var7;
      return var2 / (1.0D - var11);
   }

   static double f(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      double var7 = b(var0, var1, var6);
      double var9 = a(var0, var1, (byte)1, var6);
      return (var4 - var2) / var2 * var7 / var9;
   }

   static double a(DateTime var0, DateTime var1, double var2, double var4, int var6, int var7, boolean var8) {
      double var9 = a(var0, var1, var6, var7);
      double var11 = b(var0, var1, var6, var7);
      double var13 = f(var0, var1, var6, var7);
      double var15 = var11 - var9;
      double var17 = var15 / var11;
      double var19 = var17 + var13 - 1.0D;
      double var21 = var4 / (double)var6 + 1.0D;
      double var23 = Math.pow(var21, var19);
      double var25 = var19 * 100.0D / var23;
      double var27 = 100.0D / var23;
      double var29 = 0.0D;
      double var31 = 0.0D;

      for(int var33 = 1; (double)var33 <= var13; ++var33) {
         double var34 = (double)(var33 - 1) + var17;
         double var36 = Math.pow(var21, var34);
         double var38 = 100.0D * var2 / (double)var6 / var36;
         var29 += var38 * var34;
         var31 += var38;
      }

      double var40 = var25 + var29;
      double var35 = var27 + var31;
      return var8 ? var40 / var35 / (double)var6 / var21 : var40 / var35 / (double)var6;
   }

   static double a(DateTime var0, DateTime var1, double var2, double var4, double var6, int var8, int var9) {
      double var10 = f(var0, var1, var8, var9);
      DateTime var12 = e(var0, var1, var8, var9);
      double var13 = a(var12, var0, (byte)1, var9);
      double var15 = b(var0, var1, var8, var9);
      double var17 = var15 - var13;
      double var19 = 100.0D * var2 / (double)var8;
      double var21 = var19 * var13 / var15;
      double var23 = var6 / Math.pow(1.0D + var4 / (double)var8, var10 - 1.0D + var17 / var15);
      double var25 = 0.0D;
      double var27 = 0.0D;

      for(int var29 = 1; (double)var29 <= var10; ++var29) {
         var25 += var19 / Math.pow(1.0D + var4 / (double)var8, (double)(var29 - 1) + var17 / var15);
      }

      if (var10 == 1.0D) {
         var27 = (var6 + var19) / (1.0D + var17 / var15 * var4 / (double)var8) - var21;
      } else {
         var27 = var23 + var25 - var21;
      }

      return var27;
   }

   static zagu b(DateTime var0, DateTime var1, double var2, double var4, double var6, int var8, int var9) {
      if (f(var0, var1, var8, var9) <= 1.0D) {
         DateTime var19 = e(var0, var1, var8, var9);
         double var11 = a(var19, var0, (byte)1, var9);
         double var13 = b(var0, var1, var8, var9);
         double var15 = var6 / 100.0D + var2 / (double)var8 - (var4 / 100.0D + var11 / var13 * var2 / (double)var8);
         double var17 = var4 / 100.0D + var11 / var13 * var2 / (double)var8;
         return new zyy(var15 / var17 * (double)var8 * var13 / (var13 - var11 + 1.0D));
      } else {
         zagu var10 = (new zaoy(var0, var1, var2, (int)var6, var8, var9, var4, 0.001D)).c(0.05D);
         return (zagu)(var10.b() == 0 ? zyz.a(zsk.b(zst.i)) : var10);
      }
   }

   static double a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7) {
      double var8 = b(var2, var0, var7);
      double var10 = a(var2, var1, (byte)1, var7);
      double var12 = a(var2, var0, (byte)1, var7);
      double var14 = var10 - var12;
      double var16 = 100.0D + var10 / var8 * var3 * 100.0D;
      double var18 = 1.0D + var14 / var8 * var5;
      double var20 = var12 / var8 * var3 * 100.0D;
      return var16 / var18 - var20;
   }

   static double b(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7) {
      double var8 = b(var2, var0, var7);
      double var10 = a(var2, var1, (byte)1, var7);
      double var12 = a(var2, var0, (byte)1, var7);
      double var14 = var10 - var12;
      double var16 = var10 / var8 * var3 + 1.0D - var5 / 100.0D - var12 / var8 * var3;
      double var18 = var5 / 100.0D + var12 / var8 * var3;
      double var20 = var8 / var14;
      return var16 / var18 * var20;
   }

   static double a(DateTime var0, DateTime var1, DateTime var2, DateTime var3, double var4, double var6, double var8, int var10, int var11) {
      int var12 = 12 / var10;
      int var13 = -var12;
      double var14 = b(var0, var1, var10, var11);
      double var16 = f(var0, var1, var10, var11);
      double var18 = (double)var10;
      double var20 = c(var2, var3, var11);
      double var22;
      double var36;
      double var41;
      if (var20 < var14) {
         var22 = c(var0, var3, var11);
         double var57 = c(var2, var0, var11);
         double var26 = var6 / var18 + 1.0D;
         double var28 = var22 / var14;
         double var30 = var26;
         double var32 = Math.pow(var26, var16 - 1.0D + var28);
         double var34 = var8 / var32;
         var36 = 100.0D * var4 / var18 * var20 / var14 / Math.pow(var26, var28);
         double var59 = 0.0D;

         for(int var40 = 2; (double)var40 <= var16; ++var40) {
            var41 = 100.0D * var4 / var18 / Math.pow(var30, (double)(var40 - 1) + var28);
            var59 += var41;
         }

         double var61 = var4 / var18;
         double var42 = var57 / var14 * var61 * 100.0D;
         return var34 + var36 + var59 - var42;
      } else {
         var22 = f(var2, var3, var10, var11);
         DateTime var24 = var3;
         double var25 = 0.0D;
         double var27 = 0.0D;
         double var29 = 0.0D;
         double var31 = 0.0D;

         double var33;
         DateTime var35;
         for(var33 = var22; var33 >= 1.0D; --var33) {
            var35 = a(var24, var13, var11, true);
            var36 = 0.0D;
            if (var11 == 1) {
               var36 = c(var35, var24, var11);
            } else {
               var36 = var14;
            }

            if (var33 > 1.0D) {
               var29 = var36;
            } else {
               var29 = c(var2, var24, var11);
            }

            DateTime var38 = com.aspose.cells.a.c.zk.b(var2, var35) ? var2 : var35;
            DateTime var39 = com.aspose.cells.a.c.zk.d(var0, var24) ? var0 : var24;
            var31 = c(var38, var39, var11);
            var24 = var35;
            var25 += var29 / var36;
            var27 += var31 / var36;
         }

         var33 = 0.0D;
         if (var11 != 2 && var11 != 3) {
            var35 = e(var0, var3, var10, var11);
            var36 = a(var35, var0, (byte)1, var11);
            var33 = var14 - var36;
         } else {
            var35 = d(var0, var3, var10, var11);
            var33 = c(var0, var35, var11);
         }

         double var58 = (double)a(var3, var0, var12, var11, true);
         double var37 = f(var3, var1, var10, var11);
         double var60 = var6 / var18 + 1.0D;
         var41 = var33 / var14;
         double var43 = var60;
         double var45 = Math.pow(var60, var41 + var58 + var37);
         double var47 = var8 / var45;
         double var49 = 100.0D * var4 / var18 * var25 / Math.pow(var60, var58 + var41);
         double var51 = 0.0D;

         for(int var53 = 1; (double)var53 <= var37; ++var53) {
            double var54 = 100.0D * var4 / var18 / Math.pow(var43, (double)var53 + var58 + var41);
            var51 += var54;
         }

         double var56 = 100.0D * var4 / var18 * var27;
         return var47 + var49 + var51 - var56;
      }
   }

   static double a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, double var7, int var9, int var10, boolean var11) {
      double var12 = (double)var9;
      int var14 = 12 / var9;
      double var16 = f(var2, var1, var9, var10);
      DateTime var18 = var2;
      double var19 = 0.0D;
      double var21 = 0.0D;
      double var23 = 0.0D;
      double var25 = 0.0D;
      double var27 = 0.0D;

      double var29;
      for(var29 = 1.0D; var29 <= var16; ++var29) {
         DateTime var31 = a(var18, var14, var10, true);
         double var32 = d(var18, var31, var10);
         if (var29 < var16) {
            var23 = var32;
         } else {
            var23 = d(var18, var1, var10);
         }

         if (com.aspose.cells.a.c.zk.d(var31, var0)) {
            var25 = var23;
         } else if (com.aspose.cells.a.c.zk.d(var18, var0)) {
            var25 = c(var18, var0, var10);
         } else {
            var25 = 0.0D;
         }

         DateTime var34 = com.aspose.cells.a.c.zk.b(var0, var18) ? var0 : var18;
         DateTime var35 = com.aspose.cells.a.c.zk.d(var1, var31) ? var1 : var31;
         double var36 = c(var34, var35, var10);
         var18 = var31;
         var19 += var23 / var32;
         var21 += var25 / var32;
         var27 += var36 / var32;
      }

      var29 = 100.0D * var3 / var12;
      double var38 = var19 * var29 + var7;
      double var33 = 0.0D;
      double var39 = 0.0D;
      if (var11) {
         var33 = var27 * var5 / var12 + 1.0D;
         var39 = var21 * var29;
         return var38 / var33 - var39;
      } else {
         var33 = var21 * var29 + var5;
         var39 = var12 / var27;
         return (var38 - var33) / var33 * var39;
      }
   }

   static zagu a(double var0, DateTime var2, DateTime var3, double var4, double var6, double var8, int var10) {
      if (var0 >= 0.0D && var4 >= 0.0D && var4 < var0 && var6 >= 0.0D && !com.aspose.cells.a.c.zk.a(var2, var3) && var8 >= 0.0D && var10 != 2) {
         double var11 = 1.0D / var8;
         if (var11 > 0.0D && var11 < 3.0D || var11 > 4.0D && var11 < 5.0D) {
            return zze.a;
         } else {
            double var13 = Math.ceil(var11);
            if (var0 != var4 && var6 <= var13) {
               double var15 = b(var13);
               double var17 = var8 * var15;
               double var19 = a(var2, var10);
               DateTime var21 = b(var2, var10);
               DateTime var22 = b(var3, var10);
               double var23 = a(var21, var22, (byte)1, var10);
               double var25 = var23 / var19 * var17 * var0;
               double var27 = 0.0D;
               if (var25 == 0.0D) {
                  var27 = var0 * var17;
               } else {
                  var27 = var25;
               }

               double var29 = 0.0D;
               if (var25 == 0.0D) {
                  var29 = var13;
               } else {
                  var29 = var13 + 1.0D;
               }

               double var31 = var0 - var4;
               double var33 = 0.0D;
               if (var27 > var31) {
                  var33 = var31;
               } else {
                  var33 = var27;
               }

               double var35 = c(var33);
               double var37 = 0.0D;
               if (var6 == 0.0D) {
                  var37 = var35;
               } else {
                  var37 = a(1.0D, 0.0D, var17, var0 - var35, var29, var6, var4);
               }

               return new zyy(var37);
            } else {
               return zyy.a;
            }
         }
      } else {
         return zze.a;
      }
   }

   static zagu b(double var0, DateTime var2, DateTime var3, double var4, double var6, double var8, int var10) {
      if (var0 >= 0.0D && var4 >= 0.0D && var4 < var0 && var6 >= 0.0D && !com.aspose.cells.a.c.zk.a(var2, var3) && var8 >= 0.0D && var10 != 2) {
         double var11 = Math.ceil(1.0D / var8);
         double var13 = a(var2, var10);
         DateTime var15 = b(var2, var10);
         DateTime var16 = b(var3, var10);
         double var17 = a(var15, var16, (byte)1, var10);
         double var19 = var17 / var13 * var8 * var0;
         double var21 = 0.0D;
         if (var19 == 0.0D) {
            var21 = var0 * var8;
         } else {
            var21 = var19;
         }

         double var23 = 0.0D;
         if (var19 == 0.0D) {
            var23 = var11;
         } else {
            var23 = var11 + 1.0D;
         }

         double var25 = var0 - var4;
         double var27 = 0.0D;
         if (var21 > var25) {
            var27 = var25;
         } else {
            var27 = var21;
         }

         double var29 = 0.0D;
         if (var0 != var4 && var6 <= var23) {
            if (var6 == 0.0D) {
               var29 = var27;
            } else {
               double var31 = var8 * var0;
               double var33 = var0 - var4 - var27;
               var29 = a(1.0D, var31, var33, var6);
            }
         } else {
            var29 = 0.0D;
         }

         return new zyy(var29);
      } else {
         return zze.a;
      }
   }

   static zagu a(double[] var0, int var1, int var2, double var3, double var5) {
      int var7 = 0;

      for(int var8 = var1; var8 < var2; ++var8) {
         if (var0[var8] < 0.0D) {
            ++var7;
         }
      }

      if (var7 != 0 && var7 != var2 - var1) {
         double[] var16 = new double[var2 - var1 - var7];
         double[] var9 = new double[var7];
         int var10 = 0;
         int var11 = 0;

         for(int var12 = var1; var12 < var2; ++var12) {
            if (var0[var12] < 0.0D) {
               var9[var11++] = var0[var12];
            } else {
               var16[var10++] = var0[var12];
            }
         }

         double var17 = -a(var5, var16) * Math.pow(1.0D + var5, (double)var16.length);
         double var14 = a(var3, var9) * (1.0D + var3);
         return new zyy(Math.pow(var17 / var14, 1.0D / (double)(var2 - var1 - 1)) - 1.0D);
      } else {
         return zza.a;
      }
   }

   private static double a(double var0, double[] var2) {
      double var3 = var0 + 1.0D;
      double var5 = 0.0D;

      for(int var7 = 0; var7 < var2.length; ++var7) {
         var5 += var2[var7] / var3;
         var3 *= var0 + 1.0D;
      }

      return var5;
   }

   private static double a(DateTime var0, DateTime var1, boolean var2) {
      int var3 = var1.getDay();
      int var4 = var0.getDay();
      if (a(var1) && (var2 || a(var0))) {
         var3 = 30;
      }

      if (var3 == 31 && (var2 || var0.getDay() >= 30)) {
         var3 = 30;
      }

      if (var0.getDay() == 31) {
         var4 = 30;
      }

      if (a(var0)) {
         var4 = 30;
      }

      return c(new DateTime(var0.getYear(), var0.getMonth(), var4), new DateTime(var1.getYear(), var1.getMonth(), var3));
   }

   private static double b(DateTime var0, DateTime var1) {
      int var2 = var1.getDay();
      int var3 = var0.getDay();
      if (var3 == 31) {
         var3 = 30;
      }

      if (var2 == 31) {
         var2 = 30;
      }

      return c(new DateTime(var0.getYear(), var0.getMonth(), var3), new DateTime(var1.getYear(), var1.getMonth(), var2));
   }

   private static double c(DateTime var0, DateTime var1) {
      double var2 = (double)(var1.getYear() - var0.getYear());
      double var4 = (double)(var1.getMonth() - var0.getMonth());
      double var6 = (double)(var1.getDay() - var0.getDay());
      return var2 * 360.0D + var4 * 30.0D + var6;
   }

   private static double d(DateTime var0, DateTime var1) {
      DateTime var2 = var0;
      DateTime var3 = var1;
      if (var0.getDay() > 28 && var0.getMonth() == 2) {
         var2 = new DateTime(var0.getYear(), var0.getMonth(), 28);
      }

      if (var1.getDay() > 28 && var1.getMonth() == 2) {
         var3 = new DateTime(var1.getYear(), var1.getMonth(), 28);
      }

      DateTime var4 = new DateTime(var3.getYear(), var2.getMonth(), var2.getDay());
      return (double)((var3.getYear() - var2.getYear()) * 365) + a(var4, var3);
   }

   private static boolean a(DateTime var0) {
      return var0.getMonth() == 2 && b(var0);
   }

   private static boolean b(DateTime var0) {
      int var1 = var0.getMonth();
      var0 = var0.addDays(1.0D);
      return var0.getMonth() != var1;
   }

   private static int a(int var0, int var1) {
      switch(var1) {
      case 2:
         DateTime var2 = new DateTime(var0, var1 + 1, 1);
         return var2.addDays(-1.0D).getDay();
      case 3:
      case 5:
      case 7:
      case 8:
      case 10:
      default:
         return 31;
      case 4:
      case 6:
      case 9:
      case 11:
         return 30;
      }
   }

   private static double a(DateTime var0, DateTime var1, int var2) {
      DateTime var3 = e(var0, var1, var2, 1);
      DateTime var4 = d(var0, var1, var2, 1);
      return a(var3, var4);
   }

   private static DateTime a(DateTime var0, DateTime var1, int var2, int var3, double var4, boolean var6) {
      boolean var7 = false;
      if (var2 > 0) {
         var7 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var7 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      if (var7) {
         return var0;
      } else {
         DateTime var8 = var1;
         DateTime var9 = var1;

         while(com.aspose.cells.a.c.zk.b(var8, var0)) {
            var9 = var8;
            var8 = a(var8, var2, var3, true);
            if (com.aspose.cells.a.c.zk.a(var8, var1)) {
               break;
            }
         }

         return var9;
      }
   }

   private static DateTime a(DateTime var0, int var1, int var2, boolean var3) {
      DateTime var4 = var0.addMonths(var1);
      return var3 && var2 == 1 && b(var0) && !b(var4) ? new DateTime(var4.getYear(), var4.getMonth(), a(var4.getYear(), var4.getMonth())) : var4;
   }

   private static double a(DateTime var0, DateTime var1, byte var2, int var3) {
      double var4 = 0.0D;
      switch(var3) {
      case 0:
         var4 = a(var0, var1, false);
         break;
      case 1:
         var4 = a(var0, var1);
         break;
      case 2:
         if (var2 == 1) {
            var4 = a(var0, var1);
         } else {
            var4 = a(var0, var1, false);
         }
         break;
      case 3:
         if (var2 == 1) {
            var4 = a(var0, var1);
         } else {
            var4 = d(var0, var1);
         }
         break;
      case 4:
         var4 = b(var0, var1);
      }

      return var4;
   }

   private static double b(DateTime var0, DateTime var1, int var2) {
      switch(var2) {
      case 0:
         return 360.0D;
      case 1:
         if (!e(var0, var1)) {
            double var3 = (double)(var1.getYear() - var0.getYear() + 1);
            double var5 = a(new DateTime(var0.getYear(), 1, 1), new DateTime(var1.getYear() + 1, 1, 1));
            return var5 / var3;
         } else {
            if (f(var0, var1)) {
               return 366.0D;
            }

            return 365.0D;
         }
      case 2:
         return 360.0D;
      case 3:
         return 365.0D;
      case 4:
         return 360.0D;
      default:
         return 360.0D;
      }
   }

   private static boolean e(DateTime var0, DateTime var1) {
      return var0.getYear() == var1.getYear() || var1.getYear() == var0.getYear() + 1 && (var0.getMonth() > var1.getMonth() || var0.getMonth() == var1.getMonth() && var0.getDay() >= var1.getDay());
   }

   private static boolean f(DateTime var0, DateTime var1) {
      return var0.getYear() == var1.getYear() && a((double)var0.getYear()) || var1.getMonth() == 2 && var1.getDay() == 29 || g(var0, var1);
   }

   private static boolean g(DateTime var0, DateTime var1) {
      if (var0.getYear() == var1.getYear() && a((double)var0.getYear())) {
         return var0.getMonth() <= 2 && var1.getMonth() > 2;
      } else if (var0.getYear() == var1.getYear()) {
         return false;
      } else if (var1.getYear() == var0.getYear() + 1) {
         if (a((double)var0.getYear())) {
            return var0.getMonth() <= 2;
         } else if (a((double)var1.getYear())) {
            return var1.getMonth() > 2;
         } else {
            return false;
         }
      } else {
         return false;
      }
   }

   private static boolean a(double var0) {
      return var0 % 4.0D == 0.0D && var0 % 100.0D != 0.0D || var0 % 400.0D == 0.0D;
   }

   private static double a(DateTime var0, int var1) {
      if (var1 == 1) {
         return a((double)var0.getYear()) ? 366.0D : 365.0D;
      } else {
         return b(var0, var0, var1);
      }
   }

   private static DateTime b(DateTime var0, int var1) {
      return (var1 == 1 || var1 == 3) && a((double)var0.getYear()) && var0.getMonth() == 2 && var0.getDay() >= 28 ? new DateTime(var0.getYear(), var0.getMonth(), 28) : var0;
   }

   private static double c(DateTime var0, DateTime var1, int var2) {
      return Math.max(a(var0, var1, (byte)1, var2), 0.0D);
   }

   private static int a(DateTime var0, DateTime var1, int var2, int var3, boolean var4) {
      boolean var5;
      if (var2 > 0) {
         var5 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var5 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      if (var5) {
         return 0;
      } else {
         int var6 = -1;

         for(DateTime var7 = var1; com.aspose.cells.a.c.zk.d(var7, var0); ++var6) {
            var7 = a(var7, var2, var3, true);
         }

         return var6;
      }
   }

   private static double d(DateTime var0, DateTime var1, int var2) {
      return var2 == 0 ? h(var0, var1) : c(var0, var1, var2);
   }

   private static double h(DateTime var0, DateTime var1) {
      return Math.max(a(var0, var1, true), 0.0D);
   }

   private static double b(double var0) {
      if (var0 >= 3.0D && var0 <= 4.0D) {
         return 1.5D;
      } else if (var0 >= 5.0D && var0 <= 6.0D) {
         return 2.0D;
      } else {
         return var0 > 6.0D ? 2.5D : 1.0D;
      }
   }

   private static double c(double var0) {
      return var0 > 0.0D ? Math.floor(var0 + 0.5D) : Math.ceil(var0 - 0.5D);
   }

   private static boolean b(double var0, double var2) {
      return Math.abs(var0 - var2) < 1.0E-4D;
   }

   private static double a(double var0, double var2, double var4, double var6, double var8, double var10, double var12) {
      if (var0 > var10) {
         return c(var2);
      } else {
         ++var0;
         double var14 = var8 - var0;
         double var16 = b(var14, 2.0D) ? var6 * 0.5D : var6 * var4;
         var4 = b(var14, 2.0D) ? 1.0D : var4;
         if (var6 < var12) {
            if (var6 - var12 < 0.0D) {
               var2 = 0.0D;
            } else {
               var2 = var6 - var12;
            }
         } else {
            var2 = var16;
         }

         var6 -= var2;
         return a(var0, var2, var4, var6, var8, var10, var12);
      }
   }

   static double a(double var0, double var2, double var4, double var6) {
      if (var0 > var6) {
         return var2;
      } else {
         var2 = var2 > var4 ? var4 : var2;
         double var8 = var4 - var2;
         var4 = var8 < 0.0D ? 0.0D : var8;
         return a(var0 + 1.0D, var2, var4, var6);
      }
   }
}
